





*************************Table 3********************************************
*************************Table 3********************************************
*************************Table 3********************************************


*--------------------------------------------------------------------
* Part I: Column 1-6 of Table 3: Results for Labor inefficiency gap 
*-------------------------------------------------------------------
cd "D:\Nanjing\2020\wage gap\Replication"

use "labor-basic-tpu-reg-1.dta",clear

* xtset newid t
 egen provyear=group(province  t)
 egen ind2year=group(ind2_adj  t)
 egen owneryear=group(QiuType  t)
 egen provowneryear=group(province QiuType  t)
 egen ind4year=group(ind4_adj  t)
gen lnabsG_gdp=ln(absG_gdp)

winsor2 tfp_op lnabsG_gdp lnage  finance2  lnkL rate , replace cuts(1 99) trim
winsor2 lnRD, replace cuts(0 99) trim
drop if VMPL<0
*3.1 column1:
reg lnabsG_gdp  did,  cluster (ind4year)   

*3.2 column2:
reghdfe lnabsG_gdp  did Llnl, ///
absorb(t newid) cluster (ind4year)   

*3.3 column3:
reghdfe lnabsG_gdp  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2, ///
absorb(t newid) cluster (ind4year)   


*3.4 column4:
reghdfe lnabsG_gdp  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(t newid) cluster (ind4year)   




cap drop year
gen year=.
replace year=t-1997 if t<=2000
replace year=0 if year==.
gen year2=year^2

* 3.5 column 5: linear trend
reghdfe lnabsG_gdp  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(newid t newid##c.year) cluster (ind4year)   

* 3.6 column 6: qudratic trend

reghdfe lnabsG_gdp  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb( newid t newid##c.year newid##c.year2) cluster (ind4year)   

*--------------------------------------------------------------------------------------------


*----------------------------------------------------------------------
*Part II Column 7-12 of Table 3: Results for capital inefficiency gap 
*---------------------------------------------------------------------

cd "D:\Nanjing\2020\wage gap\Replication"

use "labor-basic-tpu-reg-1.dta",clear

gen VMPK=capitale*(y_ind_add1/k)

drop if VMPK<0

/*
* distribution of VMPK
twoway (kdensity VMPK if VMPK<5.3, color(red)),  xtitle(VMPK) ytitle(Distribution)
graph export "D:\Nanjing\2020\wage gap\RR\results\VMPK_dist.eps",replace
*/


*1. generate capital category:
bysort id: gen indc_n=_n==1
gen m_k=k if indc_n==1
bysort id: egen M_k=max(m_k)

egen p1=pctile(M_k), p(25)
egen p2=pctile(M_k), p(50)
egen p3=pctile(M_k), p(75)
gen size_k=0
replace size_k=1 if M_k<=p1
replace size_k=2 if M_k>p1&M_k<p2
replace size_k=3 if M_k>p2&M_k<p3
replace size_k=4 if M_k>p3

 bysort t indc: egen agg_l=sum(n)
 gen l_s=n/agg_l
 
*2. generate average rental rate in each category:
bysort city ind4_adj QiuType size_k t: egen r_rate=sum(l_s*VMPK) if inv>0
*bysort county ind4_adj QiuType size_k t: egen r_rate=mean(VMPK) if inv>0


* 3. gap measured in capital:

gen gdp_def=1
replace gdp_def=1.077 if t==1999
replace gdp_def=1.077*1.085 if t==2000
replace gdp_def=1.077*1.085*1.083 if t==2001
replace gdp_def=1.077*1.085*1.083*1.091 if t==2002
replace gdp_def=1.077*1.085*1.083*1.091*1.10 if t==2003
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201 if t==2004
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114 if t==2005
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127 if t==2006
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127*1.142 if t==2007

/*
gen gdp_def=1
replace gdp_def=1.063 if t==1999
replace gdp_def=1.177 if t==2000
replace gdp_def=1.302 if t==2001
replace gdp_def=1.428 if t==2002
replace gdp_def=1.819 if t==2003
replace gdp_def=1.899 if t==2004
replace gdp_def=2.198 if t==2005
replace gdp_def=2.575 if t==2006
replace gdp_def=3.170 if t==2007
*/

gen gap_k=VMPK-r_rate
gen abs_G_k=abs(gap_k)
gen lnabs_k=log(abs_G_k)


 egen provyear=group(province  t)
 egen ind2year=group(ind2_adj  t)
 egen owneryear=group(QiuType  t)
 egen provowneryear=group(province QiuType  t)
 egen ind4year=group(ind4_adj  t)


 *3.7 column 7 of Table 3:
 reghdfe lnabs_k  did,  ///
absorb(provyear newid) cluster (ind4year)   
 

*3.8 column 8 of Table 3:
reghdfe lnabs_k  did Llnl, ///
absorb(t newid) cluster (ind4year)   

*3.9 column 9 of Table 3:
reghdfe lnabs_k  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2, ///
absorb(t newid) cluster (ind4year)   
 
 
 
*3.10. column 10 of Table 3:
reghdfe lnabs_k  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output  post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(t newid) cluster (ind4year)   
 
 
 
cap drop year
gen year=.
replace year=t-1997 if t<=2000
replace year=0 if year==.
gen year2=year^2

*3.11 column 11 of Table 3: linear trend
reghdfe lnabs_k  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
  Ltariff_input Ltariff_output  post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(newid t newid##c.year) cluster (ind4year)   


*3.12 column 12 of Table 3:quadratic trend
reghdfe lnabs_k  did  Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
  Ltariff_input Ltariff_output  post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb( newid t newid##c.year newid##c.year2) cluster (ind4year)   



*----------------------------------------------------------------------------------------------------

********************************************************************************************************
********************************************************************************************************

















*************************Table 4********************************************
*************************Table 4********************************************
*************************Table 4********************************************


*------------------------------------------------------------------
*Part I: Column 1-6 of Table 4: Results for Labor inefficiency gap 
*--------------------------------------------------------------------

cd "D:\Nanjing\2020\wage gap\Replication"

use "labor-basic-tpu-reg-1.dta",clear

use "D:\Nanjing\2020\wage gap\labor-basic-tpu-reg-1.dta",clear

* xtset newid t
 egen provyear=group(province  t)
 egen ind2year=group(ind2_adj  t)
 egen owneryear=group(QiuType  t)
 egen provowneryear=group(province QiuType  t)
 egen ind4year=group(ind4_adj  t)


gen lnabsG_gdp=ln(absG_gdp)

winsor2 tfp_op lnabsG_gdp lnage  finance2  lnkL rate , replace cuts(1 99) trim
winsor2 lnRD, replace cuts(0 99) trim
drop if VMPL<0

*4.1. column 1:
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2     ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(provyear newid) cluster (ind4year)   

*4.2. column 2:
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2     ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(owneryear newid) cluster (ind4year)   

*4.3. column 3:
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2     ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(owneryear provyear newid) cluster (ind4year)   


*4.4. column 4:
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2     ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(provowneryear newid) cluster (ind4year)   


*4.5. column 5:
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2     ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(ind2year provowneryear newid) cluster (ind4year)   

*4.6 column 6 (continuing firms)
capture drop n
gen n=1
bysort newid: egen tot_n=sum(n)
reghdfe lnabsG_gdp  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind if tot_n==10,  ///
absorb(owneryear provyear newid) cluster (ind4year)   

*----------------------------------------------------------------------------------------------------
***************************************************************************************************


*-----------------------------------------------------------------------
*Part II: Column 7-12 of Table 4: Results for capital inefficiency gap 
*-----------------------------------------------------------------------

cd "D:\Nanjing\2020\wage gap\Replication"

use "labor-basic-tpu-reg-1.dta",clear
gen VMPK=capitale*(y_ind_add1/k)

drop if VMPK<0




*1. generate capital category:
bysort id: gen indc_n=_n==1
gen m_k=k if indc_n==1
bysort id: egen M_k=max(m_k)

egen p1=pctile(M_k), p(25)
egen p2=pctile(M_k), p(50)
egen p3=pctile(M_k), p(75)
gen size_k=0
replace size_k=1 if M_k<=p1
replace size_k=2 if M_k>p1&M_k<p2
replace size_k=3 if M_k>p2&M_k<p3
replace size_k=4 if M_k>p3

 bysort t indc: egen agg_l=sum(n)
 gen l_s=n/agg_l
 
*2. generate average rental rate in each category:
bysort city ind4_adj QiuType size_k t: egen r_rate=sum(l_s*VMPK) if inv>0
*bysort county ind4_adj QiuType size_k t: egen r_rate=mean(VMPK) if inv>0


* 3. gap measured in capital:

gen gdp_def=1
replace gdp_def=1.077 if t==1999
replace gdp_def=1.077*1.085 if t==2000
replace gdp_def=1.077*1.085*1.083 if t==2001
replace gdp_def=1.077*1.085*1.083*1.091 if t==2002
replace gdp_def=1.077*1.085*1.083*1.091*1.10 if t==2003
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201 if t==2004
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114 if t==2005
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127 if t==2006
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127*1.142 if t==2007


gen gap_k=VMPK-r_rate
gen abs_G_k=abs(gap_k)
gen lnabs_k=log(abs_G_k)


 egen provyear=group(province  t)
 egen ind2year=group(ind2_adj  t)
 egen owneryear=group(QiuType  t)
 egen provowneryear=group(province QiuType  t)
 egen ind4year=group(ind4_adj  t)




*****************************************************************************************

*4.7. column 7 of Table 4:
reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(provyear newid) cluster (ind4year)   
 
 

*4.8. column 8:
reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(owneryear newid) cluster (ind4year)   

*4.9. column 9:
reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(owneryear provyear newid) cluster (ind4year)   


*4.10. column 10:
reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(provowneryear newid) cluster (ind4year)   


*4.11. column 11:
reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2 ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind ,  ///
absorb(ind2year provowneryear newid) cluster (ind4year)   


*4.12. column 12:
capture drop n
gen n=1
bysort newid: egen tot_n=sum(n)

reghdfe lnabs_k  did Llnl  Ltfp_op   Llnage  LlnkL LlnRD export_intensity Lfinance2  ///
 Ltariff_input Ltariff_output post_kl_1998 Lhhi5_lns_ind Llnk_ind if tot_n==10,  ///
absorb(owneryear province newid) cluster (ind4year)   





